package service.impl;

import mapper.UserMapper;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import pojo.User;
import service.IMainService;

import javax.annotation.Resource;

@Service("mainService")
public class MainServiceImpl implements IMainService {
    @Resource
    @Qualifier("userMapper")
    private UserMapper userMapper;

    @Override
    public User getUserById(int userId) {
        return this.userMapper.selectByPrimaryKey(userId);
    }

    @Override
    public User login(User user) {

        return this.userMapper.selectByLogin(user);
    }

    @Override
    public int register(User user) {
        return this.userMapper.insertSelective(user);
    }
}
